Type Checking for JavaScript

نویسندگان

  • Christopher Anderson
  • Paola Giannini
چکیده

JavaScript is a powerful imperative object based language made popular by its use in web pages. It supports flexible program development by allowing dynamic addition of members to objects. Code is dynamically typed: a runtime access to a non-existing member causes an error. We suggest two static type systems for JavaScript that will detect such runtime type errors. Therefore, programmers can have the benefit of flexible programming offered by JavaScript with the safety offered by a static type system. We demonstrate our type systems with a formalism of JavaScript, JS0. Both type systems are based on structural recursive types. Members of a type are classified into definite and potential. The type of an object can evolve through assignment to potential members which turns them to definite. We first present a type system with integer and object types, and then we extend it adding also type variables to have polymorphism à la ML. We prove that our type systems are sound.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Precise Type Checking for JavaScript

OF THE DISSERTATION Precise Type Checking for JavaScript

متن کامل

JSTyper: Type inference for JavaScript

As with all untyped languages, JavaScript programs can contain type-mismatch-style errors. These mistakes do not necessarily cause runtime errors and can lead to subtle faults in deployed web apps. Type checking key portions of JavaScript applications can identify these mistakes early. Previous efforts to augment JavaScript with a type system have led to syntax extensions and compulsory type an...

متن کامل

Type Systems of Scripting Languages

Type systems play an important role in the design of programming languages, they prevent programs from having non-correct behavior. Typically, type systems are expressed in two ways, type-checking and type inference. The type information presented on local variables and method arguments makes the difference in choosing one technique rather than the other. Type checking is a derivation type infe...

متن کامل

Static typing & JavaScript libraries: towards a more considerate relationship

In this paper, after relating a short history of the mostly unhappy relationship between static typing and JavaScript (JS), we explain a new attempt at conciliating them which is more respectful of both worlds than other approaches. As an example, we present Onyo [1], an advanced binding of the Enyo JS library for the OCaml language. Onyo exploits the expressiveness of OCaml’s type system to pr...

متن کامل

Self-Checking Spreadsheets: Recognition of Semantics

This paper demonstrates a self-checking (self-validating) spreadsheet. This checking analyzes the meaning or semantics of using a parsing scheme. These semantics go beyond dimension, unit, and type checking to include the physical and mathematical formulae that dominate science, engineering, and mathematics. The spreadsheet is a client, JavaScript web application working with a server applicati...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • Electr. Notes Theor. Comput. Sci.

دوره 138  شماره 

صفحات  -

تاریخ انتشار 2005